<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('修改空调安装登记')" />
    <th:block th:include="include :: datetimepicker-css" />
    <th:block th:include="include :: bootstrap-fileinput-css"/>
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-electricInstall-edit" th:object="${zsyhElectricInstall}">
            <input name="id" th:field="*{id}" type="hidden">
            <div class="row">
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="col-sm-4 control-label">填写人的openid：</label>
                        <div class="col-sm-8">
                            <input name="createOpenid" th:field="*{createOpenid}" class="form-control" type="text" readonly>
                        </div>
                    </div>
                </div>
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="col-sm-4 control-label">用户姓名：</label>
                        <div class="col-sm-8">
                            <input name="userName" th:field="*{userName}" class="form-control" type="text" readonly>
                        </div>
                    </div>
                </div>
            </div>

            <div class="row">
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="col-sm-4 control-label">用户电话：</label>
                        <div class="col-sm-8">
                            <input name="userPhone" th:field="*{userPhone}" class="form-control" type="text" readonly>
                        </div>
                    </div>
                </div>
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="col-sm-4 control-label">用户地址：</label>
                        <div class="col-sm-8">
                            <input name="userAddress" th:field="*{userAddress}" class="form-control" type="text" readonly>
                        </div>
                    </div>
                </div>
            </div>

            <div class="row">
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="col-sm-4 control-label">安装师傅姓名：</label>
                        <div class="col-sm-8">
                            <input name="repairName" th:field="*{repairName}" class="form-control" type="text" readonly>
                        </div>
                    </div>
                </div>
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="col-sm-4 control-label">安装师傅电话：</label>
                        <div class="col-sm-8">
                            <input name="repairPhone" th:field="*{repairPhone}" class="form-control" type="text" readonly>
                        </div>
                    </div>
                </div>
            </div>

            <div class="row">
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="col-sm-4 control-label">安装时间：</label>
                        <div class="col-sm-8">
                            <div class="input-group date">
                                <input name="installTime" th:value="${#dates.format(zsyhElectricInstall.installTime, 'yyyy-MM-dd')}" class="form-control" placeholder="yyyy-MM-dd" type="text" readonly>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="col-sm-4 control-label">备注：</label>
                        <div class="col-sm-8">
                            <textarea name="remark" class="form-control" readonly>[[*{remark}]]</textarea>
                        </div>
                    </div>
                </div>
            </div>

            <div class="row">
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="col-sm-4 control-label">产品条码图片：</label>
                        <div class="col-sm-8">
                            <input type="hidden" name="electricCode" th:field="*{electricCode}" readonly>
                            <div class="file-loading">
                                <input class="form-control file-upload" id="electricCode" name="file" type="file" readonly>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="col-sm-4 control-label">安装完工图片：</label>
                        <div class="col-sm-8">
                            <input type="hidden" name="installImg" th:field="*{installImg}" readonly>
                            <div class="file-loading">
                                <input class="form-control file-upload" id="installImg" name="file" type="file" readonly>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

        </form>
    </div>
    <th:block th:include="include :: footer" />
    <th:block th:include="include :: datetimepicker-js" />
    <th:block th:include="include :: bootstrap-fileinput-js"/>
    <script th:inline="javascript">
        var prefix = ctx + "zsyh/electricInstall";
        $("#form-electricInstall-edit").validate({
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
                $.operate.save(prefix + "/edit", $('#form-electricInstall-edit').serialize());
            }
        }

        $("input[name='installTime']").datetimepicker({
            format: "yyyy-mm-dd",
            minView: "month",
            autoclose: true
        });

        $(".file-upload").each(function (i) {
            var val = $("input[name='" + this.id + "']").val()
            $(this).fileinput({
                'uploadUrl': ctx + 'common/uploadOSS',
                initialPreviewAsData: true,
                initialPreview: [val],
                maxFileCount: 1,
                showRemove: false,/*是否显示移除按钮*/
                showUpload: false,/*是否显示上传按钮*/
                showBrowse: false,/*是否显示浏览按钮,选择按钮*/
                showCaption: false, /*是否显示被选文件的简介*/
                autoReplace: true,
                layoutTemplates: {
                    actionDelete:'',
                    actionUpload:''
                } /*去掉缩略图上的删除和上传按钮*/
            }).on('fileuploaded', function (event, data, previewId, index) {
                $("input[name='" + event.currentTarget.id + "']").val(data.response.url)
            }).on('fileremoved', function (event, id, index) {
                $("input[name='" + event.currentTarget.id + "']").val('')
            })
            $(this).fileinput('_initFileActions');
        });
    </script>
</body>
</html>